]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/icon: Ensure icons are updated if theme node is invalid
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 22 Sep 2021 21:37:16 +0000 (23:37 +0200)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 30 Sep 2021 16:55:11 +0000 (18:55 +0200)
Icons that are changed while an actor is not mapped may not have a theme
node associated with, and thus we'd end up not updating them at all.
In fact we return early in st_update_icon(), and this was not an issue
until commit 0b1dfbf6f3f, because we'd end up to update the icon anyways
once the style was changed (and so with a valid theme node), but since
such change we might not updating the icon if no theme detail changed.

To prevent this, add a flag to require an icon update when the theme
changed, if no successfully update happened earlier.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4568
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1983>

src/st/st-icon.c

index 71ba1b6b3683a9f44128f0426c9508911e214f8a..876aa9bbbf8731184ccc12f4ac3e89ab16b6dc94 100644 (file)
@@ -59,6 +59,7 @@ struct _StIconPrivate
   gint             theme_icon_size; /* icon size from theme node */
   gint             icon_size;       /* icon size we are using */
   GIcon           *fallback_gicon;
+  gboolean         needs_update;
 
   StIconColors     *colors;
 
@@ -253,7 +254,7 @@ st_icon_style_changed (StWidget *widget)
 
   should_update |= st_icon_update_icon_size (self);
 
-  if (should_update)
+  if (priv->needs_update || should_update)
     st_icon_update (self);
 
   ST_WIDGET_CLASS (st_icon_parent_class)->style_changed (widget);
@@ -487,6 +488,8 @@ st_icon_update (StIcon *icon)
       return;
     }
 
+  priv->needs_update = TRUE;
+
   theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
   if (theme_node == NULL)
     return;
@@ -525,6 +528,7 @@ st_icon_update (StIcon *icon)
                                                          priv->icon_size / paint_scale,
                                                          paint_scale,
                                                          resource_scale);
+  priv->needs_update = FALSE;
 
   if (priv->pending_texture)
     {